<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-row gutter="24">
        <el-form-item label="专辑ID" prop="albumId">
          <el-input v-model="queryParams.albumId" placeholder="请输入专辑ID" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="专辑名称" prop="albumName">
          <el-input v-model="queryParams.albumName" placeholder="请输入专辑ID" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="剧集ID" prop="episodeId">
          <el-input v-model="queryParams.episodeId" placeholder="请输入剧集ID" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="剧集名称" prop="episodeName">
          <el-input v-model="queryParams.episodeName" placeholder="请输入剧集名称" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="原剧集ID" prop="sourceId">
          <el-input v-model="queryParams.sourceId" placeholder="请输入剧集ID" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
      </el-row>
      <el-row gutter="24">
        <el-form-item label="专辑ID集合" prop="albumIds">
          <el-input v-model="queryParams.albumIds" placeholder="请输入专辑IDs" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="剧集ID集合" prop="episodeIds">
          <el-input v-model="queryParams.episodeIds" placeholder="请输入剧集IDs" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="原剧集ID集合" prop="sourceIds">
          <el-input v-model="queryParams.sourceIds" placeholder="请输入原剧集IDs" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="CP信息" prop="cpCode">
          <el-select v-model="queryParams.cpCode" filterable placeholder="请选择注入状态" clearable
            @keyup.enter.native="handleQuery">
            <el-option value="adv_cp_code" label="默认广告商" />
            <el-option value="kpzg" label="科协-科普中国（特色）" />
            <el-option value="bjgbdst" label="北京广播电视台-科普（特色）" />
            <el-option value="dfyq" label="国广东方-戏曲（特色）" />
            <el-option value="ysw" label="央视网-国家大剧院（特色）" />
            <el-option value="zggdszjyfzzx" label="中国广电数字教育发展中心-教育（特色）" />
            <el-option value="jssjyt" label="江苏有线-教育（特色）" />
            <el-option value="lnkfdx" label="辽宁省网-老年大学（特色）" />
            <el-option value="bst_jy" label="百视通-教育（特色）" />
            <el-option value="bst_dy" label="百视通-付费单片" />
            <el-option value="zggdhnwlgfyxgs" label="湖南省网-老年大学（特色）" />
            <el-option value="hswj_cp" label="华视网聚-付费单片（全国）" />
            <el-option value="bjgh" label="北京歌华-教育（特色）" />
            <el-option value="jchswjbjwhcmyxgs" label="华视网聚-付费单片（分省）" />
            <el-option value="dfjy" label="东方嘉影-重温经典" />
            <el-option value="huashu_dy" label="华数-付费单片" />
            <el-option value="gdzj" label="广电总局-重温经典" />
            <el-option value="lngjcbzx" label="辽宁国际传播中心-乡音乡情" />
            <el-option value="lnrbs" label="辽宁日报社-乡音乡情" />
            <el-option value="huanwang_dy" label="欢网-付费单片" />
            <el-option value="bst" label="百视通-重温经典" />
            <el-option value="cqgd" label="重庆广电-乡音乡情" />
            <el-option value="nrjsyygzz" label="贵广网络-乡音乡情" />
          </el-select>
        </el-form-item>
        <el-form-item label="剧集CP状态">
          <el-select v-model="queryParams.episodeCpStatus" placeholder="请选择CP状态" clearable
            @keyup.enter.native="handleQuery">
            <el-option label="未授权" value='0'></el-option>
            <el-option label="已授权" value='1'></el-option>
            <el-option label="排播" value='3'></el-option>
          </el-select>
        </el-form-item>
      </el-row>
      <el-row gutter="24">
        <el-form-item label="码流品质">
          <el-select v-model="queryParams.quality" placeholder="请选择码流品质" clearable @keyup.enter.native="handleQuery">
            <el-option label="0" value='0'></el-option>
            <el-option label="1" value='1'></el-option>
            <el-option label="2" value='2'></el-option>
            <el-option label="3" value='3'></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="码流状态">
          <el-select v-model="queryParams.status" placeholder="请选择状态" clearable @keyup.enter.native="handleQuery">
            <el-option label="禁用" value='0'></el-option>
            <el-option label="启用" value='1'></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="码流注入状态">
          <el-select v-model="queryParams.injectStatus" placeholder="请选择码流注入状态" clearable
            @keyup.enter.native="handleQuery">
            <el-option label="待注入" value='0'></el-option>
            <el-option label="注入中" value='1'></el-option>
            <el-option label="已注入" value='2'></el-option>
            <el-option label="注入失败" value='3'></el-option>
            <el-option label="已删除" value='6'></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="剧集注入状态">
          <el-select v-model="queryParams.episodeInjectStatus" placeholder="请选择注入状态" clearable
            @keyup.enter.native="handleQuery">
            <el-option label="待注入" value='0'></el-option>
            <el-option label="注入中" value='1'></el-option>
            <el-option label="已注入" value='2'></el-option>
            <el-option label="注入失败" value='3'></el-option>
            <el-option label="已删除" value='6'></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-row>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleReCreateTsFiles"
          v-hasPermi="['jishiting:rms:resourcestream:origin:recreatetsfiles']">批量ts文件生成</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleOriginVideoTriggers"
          v-hasPermi="['jishiting:rms:resourcestream:origin:videotriggers']">批量源站注入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-plus" size="mini" @click="handleOriginProvinceVideoTriggers"
          v-hasPermi="['jishiting:rms:resourcestream:origin:province:videotriggers']">批量分省注入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-plus" size="mini" @click="handleOriginDeleteDatas"
          v-hasPermi="['jishiting:rms:resourcestream:origin:province:videodeletes']">批量分省删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-select v-model="drawerQueryParams.orgCodes" placeholder="请输入分省编码" filterable clearable size="mini">
          <el-option v-for="orgCode in orgCodeList" :key="orgCode.id" :label="orgCode.name + '-' + orgCode.code"
            :value="orgCode.code" />
        </el-select>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="mediaEpisodeList" @selection-change="handleSelectionChange" max-height="960"
      style="width: 100%">
      <el-table-column type="selection" width="55" align="center" fixed="left" />
      <el-table-column label="专辑ID" align="center" prop="albumId" width="180" />
      <el-table-column label="剧集ID" align="center" prop="episodeId" width="180" />
      <el-table-column label="专辑名称" align="center" prop="albumName" width="180" />
      <el-table-column label="专辑分类" align="center" prop="categoryName" width="180" />
      <el-table-column label="剧集名称" align="center" prop="episodeName" width="180" />
      <el-table-column label="剧集排序" align="center" prop="albumOrder" width="80" />
      <el-table-column label="码流品质" align="center" prop="quality" width="100" />
      <el-table-column label="原剧集ID" align="center" prop="sourceId" width="200" />
      <el-table-column label="ts文件状态" align="center" prop="status" width="80" fixed="right">
        <template slot-scope="scope">
          {{ scope.row.ossTsUrl == null ? '未生成' : '已生成' }}
        </template>
      </el-table-column>
      <el-table-column label="RMSCP编码" align="center" prop="rmsCpCode" width="100" />
      <el-table-column label="CDNCP编码" align="center" prop="cdnCpCode" width="100" />
      <el-table-column label="cdn源站注入状态" align="center" prop="ossInjectStatus" width="80" fixed="right" />
      <el-table-column label="码流状态" align="center" prop="status" width="80" fixed="right" />
      <el-table-column label="码流注入状态" align="center" prop="injectStatus" width="80" fixed="right" />
      <el-table-column label="专辑状态" align="center" prop="albumStatus" width="80" fixed="right" />
      <el-table-column label="专辑CP状态" align="center" prop="albumCpStatus" width="80" fixed="right" />
      <el-table-column label="剧集状态" align="center" prop="episodeStatus" width="80" fixed="right" />
      <el-table-column label="剧集CP状态" align="center" prop="episodeCpStatus" width="80" fixed="right" />
      <el-table-column label="剧集注入状态(resBase)" align="center" prop="episodeInjectStatus" width="80" fixed="right" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button v-if="scope.row.rinjectStatus != 2" @click="handleReCreateTsFile(scope.row)"
            v-hasPermi="['jishiting:rms:resourcestream:origin:recreatetsfile']" type="text"
            size="small">重新生成TS文件</el-button>
          <el-button v-if="scope.row.rinjectStatus != 2" @click="handleModifyOriginInjectStatus(scope.row)"
            v-hasPermi="['jishiting:rms:resourcestream:origin:modifyinjectstatus']" type="text"
            size="small">修改源站注入状态</el-button>
          <el-button v-if="scope.row.rinjectStatus != 2" @click="handleOriginVideoTrigger(scope.row)"
            v-hasPermi="['jishiting:rms:resourcestream:origin:videotrigger']" type="text" size="small">源站注入</el-button>
          <el-button @click="handleResourceStreamOrgData(scope.row)"
            v-hasPermi="['jishiting:rms:resourcestream:origin:province:list']" type="text"
            size="small">分省数据列表</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      :page-sizes="[10, 20, 30, 50, 100, 200, 300, 400, 500]" @pagination="getList" />


    <el-drawer title="分省注入列表" :visible.sync="dialog" direction="rtl" size="80%">
      <div>
        <el-form :model="drawerQueryParams" ref="drawerQueryForm" :inline="true" size="small" label-width="68px">
          <el-form-item label="分省编码" clearable :label-width="formLabelWidth">
            <el-select v-model="drawerQueryParams.orgCodes" placeholder="请输入分省编码" filterable clearable size="mini">
              <el-option v-for="orgCode in orgCodeList" :key="orgCode.id" :label="orgCode.name + '-' + orgCode.code"
                :value="orgCode.code" />
            </el-select>
          </el-form-item>
          <el-form-item :label-width="formLabelWidth">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleDrawerQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetDrawerQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-row :gutter="10" class="mb8" style="margin-left: 10px;">
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleProvinceVideoTriggers"
            v-hasPermi="['jishiting:rms:resourcestream:province:videotriggers']">批量注入</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-plus" size="mini"
            @click="handleModifyProvinceResourceStreamOrgs"
            v-hasPermi="['jishiting:rms:resourcestream:province:modifyProvinceResourceStreamOrg']">修改分省注入状态</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="danger" plain icon="el-icon-plus" size="mini" @click="handleDeleteOrgDatas"
            v-hasPermi="['jishiting:rms:resourcestream:province:videodeletes']">批量删除</el-button>
        </el-col>
        <right-toolbar @queryTable="handleDrawerQuery"></right-toolbar>
      </el-row>
      <el-table :data="resourceStreamOrgDataList" @selection-change="handleProvinceSelectionChange" max-height="960">
        <el-table-column type="selection" width="55" align="center" fixed="left" />
        <el-table-column property="id" label="ID" width="200" />
        <el-table-column property="albumId" label="专辑ID" width="200" />
        <el-table-column property="episodeId" label="剧集ID" width="200" />
        <el-table-column property="episodeName" label="剧集名称" width="200" />
        <el-table-column label="码流品质" align="center" prop="quality" width="100" />
        <el-table-column property="orgCode" label="分省编码" width="120" />
        <el-table-column property="nodeInjectStatus" label="CDN注入状态" fixed="right" />
        <el-table-column property="albumStatus" label="专辑状态" fixed="right" />
        <el-table-column property="albumCpStatus" label="专辑CP状态" fixed="right" />
        <el-table-column property="episodeStatus" label="剧集状态" fixed="right" />
        <el-table-column property="episodeCpStatus" label="剧集CP状态" fixed="right" />
        <el-table-column property="episodeInjectStatus" label="剧集注入状态" fixed="right" />
        <el-table-column property="resourceStreamInjectStatus" label="码流注入状态" fixed="right" />
        <el-table-column property="resourceStreamOrgInjectStatus" label="码流注入状态(org)" width="120" fixed="right" />
        <el-table-column property="createTime" label="创建时间" width="180" />
        <el-table-column property="updateTime" label="更新时间" width="180" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button @click="handleProvinceVideoTrigger(scope.row)"
              v-hasPermi="['jishiting:rms:resourcestream:province:videotrigger']" type="text"
              size="small">分省注入</el-button>
            <el-button @click="handleModifyProvinceResourceStreamOrg(scope.row)"
              v-hasPermi="['jishiting:rms:resourcestream:province:modifyProvinceResourceStreamOrg']" type="text"
              size="small">修改分省注入状态</el-button>
            <el-button v-if="scope.row.id != '' && scope.row.id != undefined" @click="handleDeleteOrgData(scope.row)"
              v-hasPermi="['jishiting:rms:resourcestream:province:videodelete']" type="text"
              size="small">分省删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-drawer>
  </div>
</template>

<script>
import { selectWithEpisodeListPage, selectProvinceListWithParam } from "@/api/jishiting/rms";
import { originVideoTrigger, originProvinceVideoTrigger, provinceVideoTrigger, modifyOriginInjectStatus, modifyProvinceResourceStreamOrg } from "@/api/jishiting/datainjection";
import { recreateTsFile, deleteOriginResourceStreamOrgData, deleteResourceStreamOrgData, selectEnableOrgCodeList } from "@/api/jishiting/gscms.js";

export default {
  name: "Notice",
  dicts: [],
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      originEpisodes: [],
      provinceEpisodes: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      //抽屉
      drawer: false,
      resourceStreamOrgDataList: [],
      dialog: false,
      // 总条数
      total: 0,
      // 剧集数据
      mediaEpisodeList: [],
      //当前选中的记录
      mediaEpisodeRow: undefined,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        albumId: undefined,
        episodeId: undefined,
        episodeIds: [],
        sourceId: undefined,
      },
      drawerQueryParams: {
        orgCodes: undefined
      },
      // 表单参数
      form: {},
      formLabelWidth: '80px',
      // 表单校验
      rules: {},
      // 分省编码列表
      orgCodeList: [],
    };
  },
  created() {
    this.selectEnableOrgCodeList();
  },
  methods: {
    /** 查询公告列表 */
    getList() {
      this.loading = true;
      selectWithEpisodeListPage(this.queryParams)
        .then((response) => {
          this.mediaEpisodeList = response.data;
          this.total = response.total;
          this.loading = false;
        })
        .catch((error) => {
          this.loading = false;
        });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        noticeId: undefined,
        noticeTitle: undefined,
        noticeType: undefined,
        noticeContent: undefined,
        status: "0",
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handleDrawerQuery() {
      this.handleRefreshResourceStreamOrgData()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
    },
    resetDrawerQuery() {
      this.drawerQueryParams = {}
      this.handleDrawerQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.originEpisodes = selection.map((item) => item);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },

    selectEnableOrgCodeList() {
      selectEnableOrgCodeList().then((response) => {
        this.orgCodeList = response.data;
      })
    },

    handleProvinceSelectionChange(selection) {
      this.provinceEpisodes = selection.map((item) => item);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    // 多选框选中数据
    handleOriginVideoTriggers(selection) {
      this.$confirm("确认批量源站注入吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.originEpisodes.forEach(element => {
          originVideoTrigger({
            reinject: true,
            videoId: element.episodeId,
          })
        });
        this.$message({
          message: "注入成功",
          type: "success",
        });
        this.getList();
      })
    },

    handleModifyOriginInjectStatusList() {
      this.$confirm("确认批量修改源站注入状态吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.originEpisodes.forEach(element => {
          modifyOriginInjectStatus({
            albumId: element.albumId,
            videoId: element.episodeId,
            injectStatus: 0,
          })
        });
        this.$message({
          message: "修改源站注入状态成功",
          type: "success",
        });
        this.getList();
      });
    },


    handleModifyOriginInjectStatus(selection) {
      this.$confirm("确认修改源站注入状态吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        modifyOriginInjectStatus({
          albumId: selection.albumId,
          videoId: selection.episodeId,
          injectStatus: 0,
        }).then((response) => {
          this.$message({
            message: "修改源站注入状态成功",
            type: "success",
          });
          this.getList();
        });
      })
    },

    handleReCreateTsFiles() {
      this.$confirm("确认批量重新生成TS文件吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.originEpisodes.forEach(element => {
          recreateTsFile({
            id: element.id,
            albumId: element.albumId,
            videoId: element.episodeId,
            quality: element.quality,
          })
        });
        this.$message({
          message: "重新生成TS文件成功",
          type: "success",
        });
        this.getList();
      })
    },

    handleReCreateTsFile(selection) {
      this.$confirm("确认重新生成TS文件吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        recreateTsFile({
          id: selection.id,
          albumId: selection.albumId,
          videoId: selection.episodeId,
          quality: selection.quality,
        }).then((response) => {
          this.$message({
            message: "重新生成TS文件成功",
            type: "success",
          });
          this.getList();
        });
      })
    },

    handleOriginVideoTrigger(selection) {
      this.$confirm("确认源站注入吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        originVideoTrigger({
          reinject: true,
          videoId: selection.episodeId,
        }).then((response) => {
          this.$message({
            message: "注入成功",
            type: "success",
          });
          this.getList();
        });
      })
    },
    handleOriginProvinceVideoTriggers() {
      this.$confirm("确认批量源站分省注入吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.originEpisodes.forEach(element => {
          originProvinceVideoTrigger({
            reinject: true,
            orgCodesStr: this.drawerQueryParams.orgCodes,
            videoId: element.episodeId,
          })
        })
        this.$message({
          message: "注入成功",
          type: "success",
        });
        this.getList();
      })
    },
    handleProvinceVideoTriggers() {
      this.$confirm("确认批量分省注入吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.provinceEpisodes.forEach(item => {
          provinceVideoTrigger({
            orgCode: item.orgCode,
            reinject: true,
            videoId: item.episodeId,
          })
        })
        this.$message({
          message: "注入成功",
          type: "success",
        });
        this.handleRefreshResourceStreamOrgData()
      })
    },
    handleProvinceVideoTrigger(selection) {
      this.$confirm("确认分省注入吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        provinceVideoTrigger({
          orgCode: selection.orgCode,
          reinject: true,
          videoId: selection.episodeId,
        }).then((response) => {
          this.$message({
            message: "注入成功",
            type: "success",
          });
          this.handleRefreshResourceStreamOrgData()
        });
      })
    },

    handleModifyProvinceResourceStreamOrgs() {
      this.$confirm("确认批量修改分省注入状态吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.provinceEpisodes.forEach(item => {
          modifyProvinceResourceStreamOrg({
            orgCode: item.orgCode,
            albumId: item.albumId,
            videoId: item.episodeId,
            injectStatus: 0
          })
        })
        this.$message({
          message: "修改状态成功",
          type: "success",
        });
        this.handleRefreshResourceStreamOrgData()
      })
    },

    handleModifyProvinceResourceStreamOrg(selection) {
      this.$confirm("确认修改分省注入状态吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        modifyProvinceResourceStreamOrg({
          orgCode: selection.orgCode,
          albumId: selection.albumId,
          videoId: selection.episodeId,
          injectStatus: 0
        }).then((response) => {
          this.$message({
            message: "修改状态成功",
            type: "success",
          });
          this.handleRefreshResourceStreamOrgData()
        });
      })
    },

    handleRefreshResourceStreamOrgData() {
      this.resourceStreamOrgDataList = [];
      selectProvinceListWithParam({
        videoId: this.mediaEpisodeRow.episodeId,
        quality: this.mediaEpisodeRow.quality,
        ...this.drawerQueryParams,
      }).then((response) => {
        this.resourceStreamOrgDataList = response.data;
      });
    },
    handleResourceStreamOrgData(row) {
      this.mediaEpisodeRow = row;
      this.resourceStreamOrgDataList = [];
      this.dialog = true;
      selectProvinceListWithParam({
        videoId: row.episodeId,
        quality: row.quality,
        ...this.drawerQueryParams
      }).then((response) => {
        this.resourceStreamOrgDataList = response.data;
      });
    },
    handleOriginDeleteDatas() {
      this.$confirm("确认批量源站分省删除吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.originEpisodes.forEach(element => {
          deleteOriginResourceStreamOrgData({
            orgCodesStr: this.drawerQueryParams.orgCodes,
            videoId: element.episodeId,
            albumId: element.albumId,
            resType: element.resType,
          })
        });
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.handleQuery();
      })
    },
    handleDeleteOrgDatas() {
      this.$confirm("确认批量分省删除吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.provinceEpisodes.forEach(element => {
          deleteResourceStreamOrgData({
            orgCode: element.orgCode,
            videoId: element.episodeId,
            albumId: element.albumId,
            resType: element.resType,
          })
        });
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.handleDrawerQuery()
      })
    },
    handleDeleteOrgData(row) {
      this.$confirm("确认分省删除吗？", "提示", {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        deleteResourceStreamOrgData({
          orgCode: row.orgCode,
          albumId: row.albumId,
          videoId: row.episodeId,
          resType: row.resType,

        }).then((response) => {
          this.$message({
            message: "删除成功",
            type: "success",
          });
          this.handleQuery();
        });
      })
    }
  },
};
</script>
